﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PM.Web
{
    public partial class I : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.hidBid.Value = Request.QueryString["bid"].Trim();
                bindData();
            }
        }

        private void bindData()
        {
            int bId; if (int.TryParse(this.hidBid.Value, out bId))
            {
                DataAccess.PmData dal = new DataAccess.PmData();
                System.Data.DataTable dt = dal.GetWebSiteISmallClassList(Common.GetCommunityCode(), bId, null);
                this.dalISmallClass.DataSource = dt;
                this.dalISmallClass.DataBind();
                
            }
            else
            {
                Common.JsAlert(this, "参数错误！");
            }
        }

        protected void dalISmallClass_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                int iSmallClassId = Convert.ToInt32(this.dalISmallClass.DataKeys[e.Item.ItemIndex]);
                Repeater repList = (Repeater)(e.Item.FindControl("repIlist"));
                if (repList != null)
                {
                    DataAccess.PmData dal = new DataAccess.PmData();
                    repList.DataSource = dal.GetWebSiteIList(Common.GetCommunityCode(), int.Parse(this.hidBid.Value), iSmallClassId, null, 5);
                    repList.DataBind();
                }
            }
        }
    }
}